#ifndef MYCHART_H
#define MYCHART_H

#include <QWidget>
#include <QWidget>
#include <QtCharts/qchart.h>
#include <QTimer>
#include <QtCharts>
#include <QLineSeries>
#include <QValueAxis>
#include <QChartView>
#include <QFont>
#include "mydata.h"

namespace Ui {
class MyChart;
}

class MyChart : public QWidget
{
    Q_OBJECT

public:
    explicit MyChart(QWidget *parent = nullptr);
    ~MyChart();
    /**
     * @brief  将波形数据显示到Chart中
     * @param  cout 显示的点位个数
     * @param  value 显示的值
     * @return
     */
    void showData(unsigned int cout ,double* value);
private:
    Ui::MyChart *ui;
    QChart *chart;
    QLineSeries *series;
    QValueAxis *axisX;
    QValueAxis *axisY;
    QChartView *chartView;
    QTimer* timer;// 定时器，刷新波形显示功能
    MyData* data;
private:
    void initWindowUI();
    void initVariable();
    void initSignalAndSlot();
private slots:
    void slotDealWithTimeout();
    void slotDealWithPreesResetChart();
    void slotDealWithPressRunChart();
    void slotDealWithPressStopChart();
};

#endif // MYCHART_H
